import 'dart:convert';

import 'package:trollee/generated/json/base/json_field.dart';
import 'package:trollee/generated/json/user_entity.g.dart';

@JsonSerializable()
class UserEntity {
  UserEntity();

  factory UserEntity.fromJson(Map<String, dynamic> json) => $UserEntityFromJson(json);

  Map<String, dynamic> toJson() => $UserEntityToJson(this);

  String? userId = ''; //用户id
  String? username = ''; //用户名®
  int? expiresIn = 0; //有效时间/秒
  int? identityType = 0; //身份类型 0, "用户", "购物车";1, "平台方", "后台管理系统";2, "渠道商", "后台管理系统;3, "广告主", 后台管理系统,
  int? identityId = 0; //身份id
  String? accessToken = ''; // 登录token
  String? refreshToken = ''; //刷新token
  int? groupId = 0; //集团id
  List? perms = []; //app权限标识集合
  String? identityName = '';
  int? age = 0;
  /// 用于state的更新，value=newData时，如果newData=oldData的对象地址引用，那么value=newData无效
  UserEntity copy() => UserEntity.fromJson(toJson());
  @override
  String toString() {
    // TODO: implement toString
    return jsonEncode(this);
  }
}
